package com.lagou.edu.aop;
import java.lang.reflect.Proxy;

public class TransactionalProxyFactory {

    private TransactionalInvocationHandler transactionalInvocationHandler;

    public TransactionalProxyFactory(TransactionalInvocationHandler transactionalInvocationHandler) {
        this.transactionalInvocationHandler = transactionalInvocationHandler;
    }

    public Object getTransactionalProxyObject(Object target) {
        return Proxy.newProxyInstance(this.getClass().getClassLoader(), target.getClass().getInterfaces(), transactionalInvocationHandler);
    }
}
